//
//  CtnManager.swift
//  MetaU
//
//  Created by PerhapYs on 2022/4/7.
//

import UIKit

class CtnManager: NSObject {

    static let shared = CtnManager()
    
    var tabbar : RootTabBarViewController?
   
    lazy var rooter: BaseNaviViewController = {
        
        let navi = BaseNaviViewController.init(rootViewController: self.makeTabbarController())
        return navi
    }()
    lazy var window: BasaeWindow = {
        
        let window = BasaeWindow.init(frame: UIScreen.main.bounds)
        window.rootViewController = CtnManager.shared.rooter
        window.makeKeyAndVisible()
        return window
    }()
    
    func resetRooter(){
        
        let rooter = BaseNaviViewController.init(rootViewController: self.makeTabbarController())
        self.rooter = rooter
        self.window.rootViewController = rooter
        self.window.makeKeyAndVisible()
    }
    
    func makeTabbarController() -> RootTabBarViewController{
        let tabbar = RootTabBarViewController()
        self.tabbar = tabbar
        return tabbar
    }
}
